package experiment03;

public class Main {
    static class rounds extends Round {
        double PI = 3.1415926;
        double a = 10;
        double b = 20;

        @Override
        public void printS() {
            double ellipse = PI * a * b;
            double circle = PI * a * a;
            if (ellipse == PI * a * b) {
                System.out.println("该图形是椭圆");
            } else {
                System.out.println("该图形是圆形");
            }
        }
    }

    static class triangles extends Triangle {
        double a = 10;
        double b = 20;

        @Override
        public void printS() {
            double triangleS = (a * b) / 2;
            if (triangleS == (a * b) / 2) {
                System.out.println("该图形是三角形");
            }
        }
    }

    static class rectangulars extends Rectangular {
        double a = 10;
        double b = 20;

        @Override
        public void printS() {
            double rectangularS = a * b;
            if (rectangularS == a * b) {
                System.out.println("该图形是矩形");
            }
        }
    }

    public static void main(String[] args) {
        Round round = new rounds();
        round.printS();
        Triangle triangle = new triangles();
        triangle.printS();
        Rectangular rectangular = new rectangulars();
        rectangular.printS();
    }
}
